<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../jsLib/angular.js"></script>
    <title></title>
    <style>
        .red{
            background-color: red;
        }
        .green{
            background-color: green;
        }
        .bg-red{
            color: red;
        }
        .bg-green{
            color: green;
        }
    </style>
</head>
<body ng-app="app" ng-controller="control">
<div class={{backColor}}>hello world</div>
<div class='bg-{{backColor}}'>hello world</div>
<button ng-click="setRed()">红色</button>
<button ng-click="setGreen()">绿色</button>
<script>
    var app=angular.module('app',[]);
    app.controller('control',function($scope){

        $scope.setRed=function(){
            $scope.backColor='red';
        }
        $scope.setGreen=function(){
            $scope.backColor='green';
        }
    })
</script>
</body>
</html>